<!DOCTYPE html><html lang="en" data-theme="light"><head><meta charset="UTF-8"><meta http-equiv="X-UA-Compatible" content="IE=edge"><meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no"><title>Java中使用HSSFWorkbook生成excel | Lorem MoonのStory</title><meta name="keywords" content="Java,Excel"><meta name="author" content="Lorem Moon"><meta name="copyright" content="Lorem Moon"><meta name="format-detection" content="telephone=no"><meta name="theme-color" content="#ffffff"><meta name="description" content="HSSFWorkbook 介绍 开发中经常会遇到 Excel 的处理，在 Java 中，操作 excel 目前有两个主流框架，分别是：  apache 的 poi   Apache POI [1]  是用Java编写的免费开源的跨平台的 Java API，Apache POI提供API给Java程式对Microsoft Office格式档案读和写的功能。POI为“Poor Obfuscation">
<meta property="og:type" content="article">
<meta property="og:title" content="Java中使用HSSFWorkbook生成excel">
<meta property="og:url" content="https://hello-github-ui.github.io/posts/53319/index.html">
<meta property="og:site_name" content="Lorem MoonのStory">
<meta property="og:description" content="HSSFWorkbook 介绍 开发中经常会遇到 Excel 的处理，在 Java 中，操作 excel 目前有两个主流框架，分别是：  apache 的 poi   Apache POI [1]  是用Java编写的免费开源的跨平台的 Java API，Apache POI提供API给Java程式对Microsoft Office格式档案读和写的功能。POI为“Poor Obfuscation">
<meta property="og:locale" content="en_US">
<meta property="og:image" content="https://pic.imgdb.cn/item/612111984907e2d39c4793a9.jpg">
<meta property="article:published_time" content="2019-11-12T14:14:11.000Z">
<meta property="article:modified_time" content="2022-03-08T12:34:42.570Z">
<meta property="article:author" content="Lorem Moon">
<meta property="article:tag" content="Java">
<meta property="article:tag" content="Excel">
<meta name="twitter:card" content="summary">
<meta name="twitter:image" content="https://pic.imgdb.cn/item/612111984907e2d39c4793a9.jpg"><link rel="shortcut icon" href="/img/favicon.png"><link rel="canonical" href="https://hello-github-ui.github.io/posts/53319/"><link rel="preconnect" href="//cdn.jsdelivr.net"/><link rel="preconnect" href="//busuanzi.ibruce.info"/><link rel="stylesheet" href="/css/index.css"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fortawesome/fontawesome-free/css/all.min.css" media="print" onload="this.media='all'"><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.css" media="print" onload="this.media='all'"><script>const GLOBAL_CONFIG = { 
  root: '/',
  algolia: {"appId":"D5QZVMNT9K","apiKey":"92de0b03da46fa778c95817524081160","indexName":"hexo-blog","hits":{"per_page":100},"languages":{"input_placeholder":"Search for Posts","hits_empty":"We didn't find any results for the search: ${query}.","hits_stats":"${hits} results found in ${time} ms"}},
  localSearch: undefined,
  translate: undefined,
  noticeOutdate: {"limitDay":365,"position":"top","messagePrev":"It has been","messageNext":"days since the last update, the content of the article may be outdated."},
  highlight: {"plugin":"highlighjs","highlightCopy":true,"highlightLang":true,"highlightHeightLimit":200},
  copy: {
    success: 'Copy successfully',
    error: 'Copy error',
    noSupport: 'The browser does not support'
  },
  relativeDate: {
    homepage: false,
    post: false
  },
  runtime: 'days',
  date_suffix: {
    just: 'Just',
    min: 'minutes ago',
    hour: 'hours ago',
    day: 'days ago',
    month: 'months ago'
  },
  copyright: undefined,
  lightbox: 'fancybox',
  Snackbar: undefined,
  source: {
    justifiedGallery: {
      js: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.js',
      css: 'https://cdn.jsdelivr.net/npm/flickr-justified-gallery@2/dist/fjGallery.min.css'
    }
  },
  isPhotoFigcaption: false,
  islazyload: false,
  isAnchor: false
}</script><script id="config-diff">var GLOBAL_CONFIG_SITE = {
  title: 'Java中使用HSSFWorkbook生成excel',
  isPost: true,
  isHome: false,
  isHighlightShrink: true,
  isToc: true,
  postUpdate: '2022-03-08 20:34:42'
}</script><noscript><style type="text/css">
  #nav {
    opacity: 1
  }
  .justified-gallery img {
    opacity: 1
  }

  #recent-posts time,
  #post-meta time {
    display: inline !important
  }
</style></noscript><script>(win=>{
    win.saveToLocal = {
      set: function setWithExpiry(key, value, ttl) {
        if (ttl === 0) return
        const now = new Date()
        const expiryDay = ttl * 86400000
        const item = {
          value: value,
          expiry: now.getTime() + expiryDay,
        }
        localStorage.setItem(key, JSON.stringify(item))
      },

      get: function getWithExpiry(key) {
        const itemStr = localStorage.getItem(key)

        if (!itemStr) {
          return undefined
        }
        const item = JSON.parse(itemStr)
        const now = new Date()

        if (now.getTime() > item.expiry) {
          localStorage.removeItem(key)
          return undefined
        }
        return item.value
      }
    }
  
    win.getScript = url => new Promise((resolve, reject) => {
      const script = document.createElement('script')
      script.src = url
      script.async = true
      script.onerror = reject
      script.onload = script.onreadystatechange = function() {
        const loadState = this.readyState
        if (loadState && loadState !== 'loaded' && loadState !== 'complete') return
        script.onload = script.onreadystatechange = null
        resolve()
      }
      document.head.appendChild(script)
    })
  
      win.activateDarkMode = function () {
        document.documentElement.setAttribute('data-theme', 'dark')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#0d0d0d')
        }
      }
      win.activateLightMode = function () {
        document.documentElement.setAttribute('data-theme', 'light')
        if (document.querySelector('meta[name="theme-color"]') !== null) {
          document.querySelector('meta[name="theme-color"]').setAttribute('content', '#ffffff')
        }
      }
      const t = saveToLocal.get('theme')
    
          if (t === 'dark') activateDarkMode()
          else if (t === 'light') activateLightMode()
        
      const asideStatus = saveToLocal.get('aside-status')
      if (asideStatus !== undefined) {
        if (asideStatus === 'hide') {
          document.documentElement.classList.add('hide-aside')
        } else {
          document.documentElement.classList.remove('hide-aside')
        }
      }
    
    const detectApple = () => {
      if(/iPad|iPhone|iPod|Macintosh/.test(navigator.userAgent)){
        document.documentElement.classList.add('apple')
      }
    }
    detectApple()
    })(window)</script><meta name="generator" content="Hexo 5.4.0"></head><body><div id="web_bg"></div><div id="sidebar"><div id="menu-mask"></div><div id="sidebar-menus"><div class="avatar-img is-center"><img src="https://pic.imgdb.cn/item/6159d89b2ab3f51d91b0e8d0.jpg" onerror="onerror=null;src='/img/friend_404.gif'" alt="avatar"/></div><div class="site-data is-center"><div class="data-item"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">60</div></a></div><div class="data-item"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">46</div></a></div><div class="data-item"><a href="/categories/"><div class="headline">Categories</div><div class="length-num">5</div></a></div></div><hr/><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/musics/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div></div></div><div class="post" id="body-wrap"><header class="post-bg" id="page-header" style="background-image: url('https://pic.imgdb.cn/item/612111984907e2d39c4793a9.jpg')"><nav id="nav"><span id="blog_name"><a id="site-name" href="/">Lorem MoonのStory</a></span><div id="menus"><div id="search-button"><a class="site-page social-icon search"><i class="fas fa-search fa-fw"></i><span> Search</span></a></div><div class="menus_items"><div class="menus_item"><a class="site-page" href="/"><i class="fa-fw fas fa-home"></i><span> Home</span></a></div><div class="menus_item"><a class="site-page" href="/archives/"><i class="fa-fw fas fa-archive"></i><span> Archives</span></a></div><div class="menus_item"><a class="site-page" href="/tags/"><i class="fa-fw fas fa-tags"></i><span> Tags</span></a></div><div class="menus_item"><a class="site-page" href="/categories/"><i class="fa-fw fas fa-folder-open"></i><span> Categories</span></a></div><div class="menus_item"><a class="site-page group" href="javascript:void(0);"><i class="fa-fw fas fa-list"></i><span> List</span><i class="fas fa-chevron-down"></i></a><ul class="menus_item_child"><li><a class="site-page child" href="/musics/"><i class="fa-fw fas fa-music"></i><span> Music</span></a></li><li><a class="site-page child" href="/movies/"><i class="fa-fw fas fa-video"></i><span> Movie</span></a></li></ul></div><div class="menus_item"><a class="site-page" href="/link/"><i class="fa-fw fas fa-link"></i><span> Link</span></a></div><div class="menus_item"><a class="site-page" href="/about/"><i class="fa-fw fas fa-heart"></i><span> About</span></a></div></div><div id="toggle-menu"><a class="site-page"><i class="fas fa-bars fa-fw"></i></a></div></div></nav><div id="post-info"><h1 class="post-title">Java中使用HSSFWorkbook生成excel<a class="post-edit-link" href="https://github.com/hello-github-ui/hexo-blog-source/tree/master/source/_posts/Java中使用HSSFWorkbook生成excel.md" title="Edited on" target="_blank"><i class="fas fa-pencil-alt"></i></a></h1><div id="post-meta"><div class="meta-firstline"><span class="post-meta-date"><i class="far fa-calendar-alt fa-fw post-meta-icon"></i><span class="post-meta-label">Created</span><time class="post-meta-date-created" datetime="2019-11-12T14:14:11.000Z" title="Created 2019-11-12 22:14:11">2019-11-12</time><span class="post-meta-separator">|</span><i class="fas fa-history fa-fw post-meta-icon"></i><span class="post-meta-label">Updated</span><time class="post-meta-date-updated" datetime="2022-03-08T12:34:42.570Z" title="Updated 2022-03-08 20:34:42">2022-03-08</time></span><span class="post-meta-categories"><span class="post-meta-separator">|</span><i class="fas fa-inbox fa-fw post-meta-icon"></i><a class="post-meta-categories" href="/categories/code/">code</a></span></div><div class="meta-secondline"><span class="post-meta-separator">|</span><span class="post-meta-wordcount"><i class="far fa-file-word fa-fw post-meta-icon"></i><span class="post-meta-label">Word count:</span><span class="word-count">2.3k</span><span class="post-meta-separator">|</span><i class="far fa-clock fa-fw post-meta-icon"></i><span class="post-meta-label">Reading time:</span><span>10min</span></span><span class="post-meta-separator">|</span><span class="post-meta-pv-cv" id="" data-flag-title="Java中使用HSSFWorkbook生成excel"><i class="far fa-eye fa-fw post-meta-icon"></i><span class="post-meta-label">Post View:</span><span id="busuanzi_value_page_pv"></span></span></div></div></div></header><main class="layout" id="content-inner"><div id="post"><article class="post-content" id="article-container"><p><img src="https://img.imgdb.cn/item/604b7e335aedab222ce6192e.jpg"></p>
<h1 id="HSSFWorkbook-介绍"><a href="#HSSFWorkbook-介绍" class="headerlink" title="HSSFWorkbook 介绍"></a>HSSFWorkbook 介绍</h1><hr>
<p>开发中经常会遇到 Excel 的处理，在 Java 中，操作 excel 目前有两个主流框架，分别是：</p>
<ul>
<li>apache 的 poi</li>
</ul>
<blockquote>
<p>Apache POI [1]  是用Java编写的免费开源的跨平台的 Java API，Apache POI提供API给Java程式对Microsoft Office格式档案读和写的功能。POI为“Poor Obfuscation Implementation”的首字母缩写，意为“简洁版的模糊实现”。</p>
</blockquote>
<ul>
<li>Java Excel</li>
</ul>
<blockquote>
<p>Java Excel是一开放源码项目，通过它Java开发人员可以读取Excel文件的内容、创建新的Excel文件、更新已经存在的Excel文件。jxl 由于其小巧 易用的特点, 逐渐已经取代了 POI-excel的地位, 成为了越来越多的java开发人员生成excel文件的首选</p>
</blockquote>
<p>这里提一下：HSSFWorkbook:是操作Excel2003以前（包括2003）的版本，扩展名是.xls；XSSFWorkbook:是操作Excel2007的版本，扩展名是.xlsx。对于不同版本的EXCEL文档要使用不同的工具类，如果使用错了，会提示如下错误信息：org.apache.poi.openxml4j.exceptions.InvalidOperationException，org.apache.poi.poifs.filesystem.OfficeXmlFileException</p>
<p><img src="https://img.imgdb.cn/item/604b7e335aedab222ce61937.jpg"></p>
<h1 id="HSSFWorkbook-的使用"><a href="#HSSFWorkbook-的使用" class="headerlink" title="HSSFWorkbook 的使用"></a>HSSFWorkbook 的使用</h1><hr>
<figure class="highlight java"><table><tr><td class="code"><pre><span class="line"><span class="keyword">package</span> com.knowledge.point;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> org.apache.poi.hssf.usermodel.*;</span><br><span class="line"><span class="keyword">import</span> org.apache.poi.ss.usermodel.Font;</span><br><span class="line"></span><br><span class="line"><span class="keyword">import</span> java.io.*;</span><br><span class="line"><span class="keyword">import</span> java.util.ArrayList;</span><br><span class="line"><span class="keyword">import</span> java.util.HashMap;</span><br><span class="line"><span class="keyword">import</span> java.util.List;</span><br><span class="line"><span class="keyword">import</span> java.util.Map;</span><br><span class="line"></span><br><span class="line"><span class="comment">/**</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@author</span>: latinos-bub</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@date</span>: 2019/11/12 17:32</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@description</span>: 测试生成 excel</span></span><br><span class="line"><span class="comment"> * <span class="doctag">@className</span>: com.knowledge.point.TestGenExcel</span></span><br><span class="line"><span class="comment"> */</span></span><br><span class="line"><span class="keyword">public</span> <span class="class"><span class="keyword">class</span> <span class="title">TestGenExcel</span> </span>&#123;</span><br><span class="line"></span><br><span class="line">    <span class="function"><span class="keyword">public</span> <span class="keyword">static</span> <span class="keyword">void</span> <span class="title">main</span><span class="params">(String[] args)</span> <span class="keyword">throws</span> Exception</span>&#123;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 创建一个 excel 工作簿</span></span><br><span class="line">        HSSFWorkbook workbook = <span class="keyword">new</span> HSSFWorkbook();</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 创建一个 excel 里面的 sheet 表格，并设置 sheet 名字</span></span><br><span class="line">        HSSFSheet sheet = workbook.createSheet(<span class="string">&quot;测试生成 excel 表格是否乱码&quot;</span>);</span><br><span class="line"></span><br><span class="line">        <span class="comment">// -------------------------------设置 工作簿的 样式 start--------------------------//</span></span><br><span class="line">        HSSFCellStyle titleStyle  = workbook.createCellStyle(); <span class="comment">// 创建标题样式</span></span><br><span class="line">        titleStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER);    <span class="comment">// 设置标题水平居中显示</span></span><br><span class="line">        titleStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER); <span class="comment">// 设置标题垂直居中显示</span></span><br><span class="line">        HSSFFont titleFont = workbook.createFont();    <span class="comment">// 创建标题字体</span></span><br><span class="line">        titleFont.setItalic(<span class="keyword">false</span>);                     <span class="comment">// 设置字体为斜体字</span></span><br><span class="line">        titleFont.setColor(Font.COLOR_RED);            <span class="comment">// 将字体设置为“红色”</span></span><br><span class="line">        titleFont.setFontHeightInPoints((<span class="keyword">short</span>)<span class="number">16</span>);    <span class="comment">// 将字体大小设置为18px</span></span><br><span class="line">        titleFont.setFontName(<span class="string">&quot;宋体&quot;</span>);             <span class="comment">// 将“宋体”字体应用到当前单元格上</span></span><br><span class="line">        titleFont.setBoldweight(HSSFFont.BOLDWEIGHT_BOLD);    <span class="comment">//加粗</span></span><br><span class="line">        titleStyle.setFont(titleFont); <span class="comment">// 将 字体应用到 标题样式上</span></span><br><span class="line"></span><br><span class="line">        HSSFCellStyle cellStyle  = workbook.createCellStyle();  <span class="comment">// 创建 cell 单元格样式</span></span><br><span class="line">        cellStyle.setAlignment(HSSFCellStyle.ALIGN_CENTER); <span class="comment">// 设置 cell 单元格水平居中显示</span></span><br><span class="line">        cellStyle.setVerticalAlignment(HSSFCellStyle.VERTICAL_CENTER);  <span class="comment">// 设置 cell 单元格垂直居中显示</span></span><br><span class="line">        Font cellFont = workbook.createFont();  <span class="comment">// 创建 单元格 字体</span></span><br><span class="line">        cellFont.setFontHeightInPoints((<span class="keyword">short</span>)<span class="number">10</span>);    <span class="comment">// 将字体大小设置为18px</span></span><br><span class="line">        cellFont.setFontName(<span class="string">&quot;宋体&quot;</span>);             <span class="comment">// 字体应用到当前单元格上</span></span><br><span class="line">        cellStyle.setFont(cellFont); <span class="comment">// 将 字体应用到 单元格样式上</span></span><br><span class="line">        <span class="comment">// -------------------------------设置 工作簿的 样式 end--------------------------//</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">        <span class="comment">// 创建 首行(即标题 行)</span></span><br><span class="line">        HSSFRow headRow = sheet.createRow(<span class="number">0</span>);</span><br><span class="line">        <span class="comment">// 创建 首行(即标题 行) 的 第一个单元格</span></span><br><span class="line">        HSSFCell headCell = headRow.createCell(<span class="number">0</span>);</span><br><span class="line">        <span class="comment">// 设置 首行(即标题 行)的文字内容</span></span><br><span class="line">        headCell.setCellValue(<span class="string">&quot;更新时间&quot;</span>);</span><br><span class="line">        headCell.setCellStyle(titleStyle); <span class="comment">// 设置 首行的 第一个单元格 样式</span></span><br><span class="line">        <span class="comment">// 创建 首行(即标题 行) 的 第二个单元格</span></span><br><span class="line">        headCell = headRow.createCell(<span class="number">1</span>);</span><br><span class="line">        headCell.setCellValue(<span class="string">&quot;创建时间&quot;</span>);</span><br><span class="line">        headCell.setCellStyle(titleStyle);  <span class="comment">// 这里一定要每次实例化之后都要设置样式</span></span><br><span class="line">        headCell = headRow.createCell(<span class="number">2</span>);</span><br><span class="line">        headCell.setCellValue(<span class="string">&quot;删除状态&quot;</span>);</span><br><span class="line">        headCell.setCellStyle(titleStyle); <span class="comment">// 这里一定要每次实例化之后都要设置样式</span></span><br><span class="line">        headCell = headRow.createCell(<span class="number">3</span>);</span><br><span class="line">        headCell.setCellValue(<span class="string">&quot;id&quot;</span>);</span><br><span class="line">        headCell.setCellStyle(titleStyle); <span class="comment">// 这里一定要每次实例化之后都要设置样式</span></span><br><span class="line">        headCell = headRow.createCell(<span class="number">4</span>);</span><br><span class="line">        headCell.setCellValue(<span class="string">&quot;书名&quot;</span>);</span><br><span class="line">        headCell.setCellStyle(titleStyle); <span class="comment">// 这里一定要每次实例化之后都要设置样式</span></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">        <span class="comment">// 获取 模拟的 List&lt;Map&lt;String, Object&gt; 数据</span></span><br><span class="line">        List&lt;Map&lt;String, Object&gt;&gt; list = getList();</span><br><span class="line"></span><br><span class="line">        <span class="keyword">for</span> (<span class="keyword">int</span> i = <span class="number">0</span>; i &lt; list.size(); i++)&#123;  <span class="comment">// 外层for是每一行的设置</span></span><br><span class="line">            <span class="comment">// 每一行(填充的内容行)时，我们都要新实例化一个 HSSRow 新行</span></span><br><span class="line">            HSSFRow contentRow = sheet.createRow(sheet.getLastRowNum() + <span class="number">1</span>);    <span class="comment">// 调用sheet的上次最后一行索引 + 1即可</span></span><br><span class="line">            <span class="keyword">for</span> (<span class="keyword">int</span> j = <span class="number">0</span>; j &lt; <span class="number">5</span>; j++)&#123;    <span class="comment">// 内层 for 是 每行的 列数设置，因为我们的标题行有5列，所以这里设置5列</span></span><br><span class="line">                <span class="comment">// 每一行，我们都要在该行(即contentRow) 实例化 5 个 cell 单元格</span></span><br><span class="line">                HSSFCell contentCell = contentRow.createCell(j);</span><br><span class="line">                <span class="keyword">switch</span> (j)&#123; <span class="comment">// 1，2，3，4，5个单元格分别写入自己正确的数据</span></span><br><span class="line">                    <span class="keyword">case</span> <span class="number">0</span>: <span class="comment">// 每一行的第一列(即第一个cell)我们都写入 update_time 对应的数据，以下依次类推</span></span><br><span class="line">                        contentCell.setCellValue(String.valueOf(list.get(i).get(<span class="string">&quot;update_time&quot;</span>)));</span><br><span class="line">                        <span class="keyword">break</span>;</span><br><span class="line">                    <span class="keyword">case</span> <span class="number">1</span>:</span><br><span class="line">                        contentCell.setCellValue(String.valueOf(list.get(i).get(<span class="string">&quot;create_time&quot;</span>)));</span><br><span class="line">                        <span class="keyword">break</span>;</span><br><span class="line">                    <span class="keyword">case</span> <span class="number">2</span>:</span><br><span class="line">                        contentCell.setCellValue(String.valueOf(list.get(i).get(<span class="string">&quot;delete_status&quot;</span>)));</span><br><span class="line">                        <span class="keyword">break</span>;</span><br><span class="line">                    <span class="keyword">case</span> <span class="number">3</span>:</span><br><span class="line">                        contentCell.setCellValue(String.valueOf(list.get(i).get(<span class="string">&quot;id&quot;</span>)));</span><br><span class="line">                        <span class="keyword">break</span>;</span><br><span class="line">                    <span class="keyword">case</span> <span class="number">4</span>:</span><br><span class="line">                        contentCell.setCellValue(String.valueOf(list.get(i).get(<span class="string">&quot;content&quot;</span>)));</span><br><span class="line">                        <span class="keyword">break</span>;</span><br><span class="line">                &#125;</span><br><span class="line">                <span class="comment">// 设置 内容 居中显示 样式</span></span><br><span class="line">                contentCell.setCellStyle(cellStyle);</span><br><span class="line">            &#125;</span><br><span class="line">        &#125;</span><br><span class="line"></span><br><span class="line">        <span class="comment">// 设置 列 的宽度</span></span><br><span class="line">        sheet.setColumnWidth(<span class="number">0</span>, <span class="number">900</span> * <span class="number">10</span>);</span><br><span class="line">        sheet.setColumnWidth(<span class="number">1</span>, <span class="number">900</span> * <span class="number">10</span>);</span><br><span class="line">        sheet.setColumnWidth(<span class="number">2</span>, <span class="number">900</span> * <span class="number">10</span>);</span><br><span class="line">        sheet.setColumnWidth(<span class="number">3</span>, <span class="number">900</span> * <span class="number">10</span>);</span><br><span class="line">        sheet.setColumnWidth(<span class="number">4</span>, <span class="number">900</span> * <span class="number">10</span>);</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">        File xlsFile = <span class="keyword">new</span> File(<span class="string">&quot;测试生成Excel.xls&quot;</span>);</span><br><span class="line">        workbook.write(<span class="keyword">new</span> FileOutputStream(xlsFile));</span><br><span class="line">        workbook.close();</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">        <span class="comment">// 补充：如果是 web 程序，需要页面打开一个对话框，保存文件则，需要额外添加以下代码即可</span></span><br><span class="line">        <span class="comment">/*String fileName = &quot;excel表&quot;;</span></span><br><span class="line"><span class="comment">        fileName = new String(fileName.getBytes(), &quot;ISO-8859-1&quot;);</span></span><br><span class="line"><span class="comment">        HttpServletResponse response = this.getResponse().getHttpResponse();</span></span><br><span class="line"><span class="comment">        response.setHeader(&quot;Content-disposition&quot;, &quot;attachment; filename=&quot; + fileName + &quot;.xls&quot;);</span></span><br><span class="line"><span class="comment">        response.setContentType(&quot;application/application/vnd.ms-excel;charset=utf-8&quot;);</span></span><br><span class="line"><span class="comment">        ByteArrayOutputStream byteArrayOutputStream = new ByteArrayOutputStream();</span></span><br><span class="line"><span class="comment">        // workbook 工作簿中写入数据</span></span><br><span class="line"><span class="comment">        workbook.write(byteArrayOutputStream);</span></span><br><span class="line"><span class="comment">        byte[] content = byteArrayOutputStream.toByteArray();</span></span><br><span class="line"><span class="comment">        InputStream inputStream = new ByteArrayInputStream(content);</span></span><br><span class="line"><span class="comment">        ServletOutputStream out = null;</span></span><br><span class="line"><span class="comment">        try &#123;</span></span><br><span class="line"><span class="comment">            out = response.getOutputStream();</span></span><br><span class="line"><span class="comment">            byte[] b = new byte[2048];  // 设置 缓冲区的读取字节大小</span></span><br><span class="line"><span class="comment">            int i;</span></span><br><span class="line"><span class="comment">            while ((i = inputStream.read(b)) &gt; 0) &#123;</span></span><br><span class="line"><span class="comment">                out.write(b, 0, i);</span></span><br><span class="line"><span class="comment">            &#125;</span></span><br><span class="line"><span class="comment">            out.flush();</span></span><br><span class="line"><span class="comment">        &#125; catch (Exception e) &#123;</span></span><br><span class="line"><span class="comment">            System.out.println(&quot;生成excel表格时出错: &quot; + e.getMessage());</span></span><br><span class="line"><span class="comment">        &#125; finally &#123;</span></span><br><span class="line"><span class="comment">            if (inputStream != null)</span></span><br><span class="line"><span class="comment">                inputStream.close();</span></span><br><span class="line"><span class="comment">            if (out != null)</span></span><br><span class="line"><span class="comment">                out.close();</span></span><br><span class="line"><span class="comment">        &#125;*/</span></span><br><span class="line">    &#125;</span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line"></span><br><span class="line">    <span class="comment">/**</span></span><br><span class="line"><span class="comment">    * <span class="doctag">@Author</span> latinos-bub</span></span><br><span class="line"><span class="comment">    * <span class="doctag">@Description</span> //TODO   这里我先准备一个从别的地方获取的 sql 结果集合，以备下面写入数据使用</span></span><br><span class="line"><span class="comment">     * 这个 List 中我们就存放 12 个 Map 即可(模拟数据)</span></span><br><span class="line"><span class="comment">    * <span class="doctag">@Date</span> 2019/11/12 21:17</span></span><br><span class="line"><span class="comment">    * <span class="doctag">@Param</span> []</span></span><br><span class="line"><span class="comment">    * <span class="doctag">@return</span> java.util.List&lt;java.util.Map&lt;java.lang.String,java.lang.Object&gt;&gt;</span></span><br><span class="line"><span class="comment">    **/</span></span><br><span class="line">    <span class="keyword">private</span> <span class="keyword">static</span> List&lt;Map&lt;String, Object&gt;&gt; getList()&#123;</span><br><span class="line"></span><br><span class="line">        List&lt;Map&lt;String, Object&gt;&gt; list = <span class="keyword">new</span> ArrayList&lt;Map&lt;String, Object&gt;&gt;();</span><br><span class="line">        Map&lt;String, Object&gt; map1 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map1.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1569404166000&quot;</span>);</span><br><span class="line">        map1.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1569404122000&quot;</span>);</span><br><span class="line">        map1.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;1&quot;</span>);</span><br><span class="line">        map1.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;2&quot;</span>);</span><br><span class="line">        map1.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;如何削铁&quot;</span>);</span><br><span class="line">        list.add(map1);</span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map2 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map2.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1509357581000&quot;</span>);</span><br><span class="line">        map2.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1508893725000&quot;</span>);</span><br><span class="line">        map2.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;1&quot;</span>);</span><br><span class="line">        map2.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;5&quot;</span>);</span><br><span class="line">        map2.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;莎士比亚&quot;</span>);</span><br><span class="line">        list.add(map2);</span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map3 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map3.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1510970055000&quot;</span>);</span><br><span class="line">        map3.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1508986168000&quot;</span>);</span><br><span class="line">        map3.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;1&quot;</span>);</span><br><span class="line">        map3.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;6&quot;</span>);</span><br><span class="line">        map3.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;亚里士多德&quot;</span>);</span><br><span class="line">        list.add(map3);</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map4 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map4.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1510118932000&quot;</span>);</span><br><span class="line">        map4.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1509001065000&quot;</span>);</span><br><span class="line">        map4.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;1&quot;</span>);</span><br><span class="line">        map4.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;10&quot;</span>);</span><br><span class="line">        map4.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;亚历山大&quot;</span>);</span><br><span class="line">        list.add(map4);</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map5 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map5.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1509002622000&quot;</span>);</span><br><span class="line">        map5.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1509002622000&quot;</span>);</span><br><span class="line">        map5.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;0&quot;</span>);</span><br><span class="line">        map5.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;11&quot;</span>);</span><br><span class="line">        map5.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;李白&quot;</span>);</span><br><span class="line">        list.add(map5);</span><br><span class="line"></span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map6 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map6.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1569376168000&quot;</span>);</span><br><span class="line">        map6.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1569404290000&quot;</span>);</span><br><span class="line">        map6.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;1&quot;</span>);</span><br><span class="line">        map6.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;12&quot;</span>);</span><br><span class="line">        map6.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;无用是什么&quot;</span>);</span><br><span class="line">        list.add(map6);</span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map7 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map7.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1569376160000&quot;</span>);</span><br><span class="line">        map7.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1569404290000&quot;</span>);</span><br><span class="line">        map7.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;0&quot;</span>);</span><br><span class="line">        map7.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;13&quot;</span>);</span><br><span class="line">        map7.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;选择吃什么饭是一件很痛苦的事&quot;</span>);</span><br><span class="line">        list.add(map7);</span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map8 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map8.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1510983431000&quot;</span>);</span><br><span class="line">        map8.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1510983427000&quot;</span>);</span><br><span class="line">        map8.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;1&quot;</span>);</span><br><span class="line">        map8.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;19&quot;</span>);</span><br><span class="line">        map8.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;文章test2&quot;</span>);</span><br><span class="line">        list.add(map8);</span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map9 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map9.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1569376164000&quot;</span>);</span><br><span class="line">        map9.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1569404290000&quot;</span>);</span><br><span class="line">        map9.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;1&quot;</span>);</span><br><span class="line">        map9.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;20&quot;</span>);</span><br><span class="line">        map9.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;就像选择在哪里睡觉一样&quot;</span>);</span><br><span class="line">        list.add(map9);</span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map10 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map10.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1569376166000&quot;</span>);</span><br><span class="line">        map10.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1569404290000&quot;</span>);</span><br><span class="line">        map10.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;1&quot;</span>);</span><br><span class="line">        map10.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;21&quot;</span>);</span><br><span class="line">        map10.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;effective of java&quot;</span>);</span><br><span class="line">        list.add(map10);</span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map11 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map11.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1569376172000&quot;</span>);</span><br><span class="line">        map11.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1569404290000&quot;</span>);</span><br><span class="line">        map11.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;1&quot;</span>);</span><br><span class="line">        map11.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;22&quot;</span>);</span><br><span class="line">        map11.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;荒岛求生&quot;</span>);</span><br><span class="line">        list.add(map11);</span><br><span class="line"></span><br><span class="line">        Map&lt;String, Object&gt; map12 = <span class="keyword">new</span> HashMap&lt;String, Object&gt;();</span><br><span class="line">        map12.put(<span class="string">&quot;update_time&quot;</span>, <span class="string">&quot;1569376170000&quot;</span>);</span><br><span class="line">        map12.put(<span class="string">&quot;create_time&quot;</span>, <span class="string">&quot;1569404290000&quot;</span>);</span><br><span class="line">        map12.put(<span class="string">&quot;delete_status&quot;</span>, <span class="string">&quot;0&quot;</span>);</span><br><span class="line">        map12.put(<span class="string">&quot;id&quot;</span>, <span class="string">&quot;23&quot;</span>);</span><br><span class="line">        map12.put(<span class="string">&quot;content&quot;</span>, <span class="string">&quot;天使永远就在身边&quot;</span>);</span><br><span class="line">        list.add(map12);</span><br><span class="line"></span><br><span class="line">        <span class="keyword">return</span> list;</span><br><span class="line">    &#125;</span><br><span class="line">&#125;</span><br><span class="line"></span><br></pre></td></tr></table></figure>

<hr>
<p><img src="https://img.imgdb.cn/item/604b7e335aedab222ce61945.jpg"></p>
<div align="middle">《行香子·归去来兮》
    -- 北宋：辛弃疾
</div>
> 归去来兮，行乐休迟。命由天、富贵何时。
百年光景，七十者稀。奈一番愁，一番病，一番衰。
名利奔驰，宠辱惊疑。旧家时、都有些儿。
而今老矣，识破关机。算不如闲，不如醉，不如痴。
</article><div class="post-copyright"><div class="post-copyright__author"><span class="post-copyright-meta">Author: </span><span class="post-copyright-info"><a href="mailto:undefined">Lorem Moon</a></span></div><div class="post-copyright__type"><span class="post-copyright-meta">Link: </span><span class="post-copyright-info"><a href="https://hello-github-ui.github.io/posts/53319/">https://hello-github-ui.github.io/posts/53319/</a></span></div><div class="post-copyright__notice"><span class="post-copyright-meta">Copyright Notice: </span><span class="post-copyright-info">All articles in this blog are licensed under <a target="_blank" rel="noopener" href="https://creativecommons.org/licenses/by-nc-sa/4.0/">CC BY-NC-SA 4.0</a> unless stating additionally.</span></div></div><div class="tag_share"><div class="post-meta__tag-list"><a class="post-meta__tags" href="/tags/Java/">Java</a><a class="post-meta__tags" href="/tags/Excel/">Excel</a></div><div class="post_share"><div class="social-share" data-image="https://pic.imgdb.cn/item/612111984907e2d39c4793a9.jpg" data-sites="facebook,twitter,wechat,weibo,qq"></div><link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/social-share.js/dist/css/share.min.css" media="print" onload="this.media='all'"><script src="https://cdn.jsdelivr.net/npm/social-share.js/dist/js/social-share.min.js" defer></script></div></div><div class="relatedPosts"><div class="headline"><i class="fas fa-thumbs-up fa-fw"></i><span>Related Articles</span></div><div class="relatedPosts-list"><div><a href="/posts/49125/" title="BIO-NIO-AIO"><img class="cover" src="https://pic.imgdb.cn/item/60d18f04844ef46bb2bcb39a.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-06-22</div><div class="title">BIO-NIO-AIO</div></div></a></div><div><a href="/posts/32282/" title="Difference between FileReader vs FileInputStream in Java"><img class="cover" src="https://pic.imgdb.cn/item/616863312ab3f51d9106e681.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-10-26</div><div class="title">Difference between FileReader vs FileInputStream in Java</div></div></a></div><div><a href="/posts/65533/" title="Java 中 IO 操作总结"><img class="cover" src="https://img.imgdb.cn/item/604b7e335aedab222ce6192e.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2020-01-06</div><div class="title">Java 中 IO 操作总结</div></div></a></div><div><a href="/posts/62287/" title="Java代码实现裁剪图像"><img class="cover" src="https://pic.imgdb.cn/item/61503a642ab3f51d91207331.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-09-26</div><div class="title">Java代码实现裁剪图像</div></div></a></div><div><a href="/posts/10968/" title="Java代码的执行顺序"><img class="cover" src="https://pic.imgdb.cn/item/612110284907e2d39c445567.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-01-31</div><div class="title">Java代码的执行顺序</div></div></a></div><div><a href="/posts/17149/" title="Java实现批量重命名文件"><img class="cover" src="https://pic.imgdb.cn/item/61503f8a2ab3f51d91265312.jpg" alt="cover"><div class="content is-center"><div class="date"><i class="far fa-calendar-alt fa-fw"></i> 2021-09-26</div><div class="title">Java实现批量重命名文件</div></div></a></div></div></div><hr/><div id="post-comment"><div class="comment-head"><div class="comment-headline"><i class="fas fa-comments fa-fw"></i><span> Comment</span></div></div><div class="comment-wrap"><div><div class="vcomment" id="vcomment"></div></div></div></div></div><div class="aside-content" id="aside-content"><div class="card-widget card-info"><div class="is-center"><div class="avatar-img"><img src="https://pic.imgdb.cn/item/6159d89b2ab3f51d91b0e8d0.jpg" onerror="this.onerror=null;this.src='/img/friend_404.gif'" alt="avatar"/></div><div class="author-info__name">Lorem Moon</div><div class="author-info__description">即已成过往，便随它而去吧。</div></div><div class="card-info-data is-center"><div class="card-info-data-item"><a href="/archives/"><div class="headline">Articles</div><div class="length-num">60</div></a></div><div class="card-info-data-item"><a href="/tags/"><div class="headline">Tags</div><div class="length-num">46</div></a></div><div class="card-info-data-item"><a href="/categories/"><div class="headline">Categories</div><div class="length-num">5</div></a></div></div><a class="button--animated" id="card-info-btn" target="_blank" rel="noopener" href="https://github.com/xxxxxx"><i class="fab fa-github"></i><span>Follow Me</span></a><div class="card-info-social-icons is-center"><a class="social-icon" href="https://github.com/hello-github-ui" target="_blank" title="Github"><i class="fab fa-github"></i></a><a class="social-icon" href="mailto:util.you.come@gmail.com" target="_blank" title="Email"><i class="fas fa-envelope"></i></a></div></div><div class="card-widget card-announcement"><div class="item-headline"><i class="fas fa-bullhorn card-announcement-animation"></i><span>Announcement</span></div><div class="announcement_content">This is my Blog</div></div><div class="sticky_layout"><div class="card-widget" id="card-toc"><div class="item-headline"><i class="fas fa-stream"></i><span>Catalog</span><span class="toc-percentage"></span></div><div class="toc-content"><ol class="toc"><li class="toc-item toc-level-1"><a class="toc-link" href="#HSSFWorkbook-%E4%BB%8B%E7%BB%8D"><span class="toc-number">1.</span> <span class="toc-text">HSSFWorkbook 介绍</span></a></li><li class="toc-item toc-level-1"><a class="toc-link" href="#HSSFWorkbook-%E7%9A%84%E4%BD%BF%E7%94%A8"><span class="toc-number">2.</span> <span class="toc-text">HSSFWorkbook 的使用</span></a></li></ol></div></div><div class="card-widget card-recent-post"><div class="item-headline"><i class="fas fa-history"></i><span>Recent Post</span></div><div class="aside-list"><div class="aside-list-item"><a class="thumbnail" href="/posts/4723/" title="Redis主从搭建"><img src="https://pic.imgdb.cn/item/61210fda4907e2d39c439d0c.jpg" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Redis主从搭建"/></a><div class="content"><a class="title" href="/posts/4723/" title="Redis主从搭建">Redis主从搭建</a><time datetime="2022-03-08T12:34:42.574Z" title="Created 2022-03-08 20:34:42">2022-03-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/43818/" title="Win10开启上帝模式"><img src="https://pic.imgdb.cn/item/621ddc1c2ab3f51d914c66cb.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Win10开启上帝模式"/></a><div class="content"><a class="title" href="/posts/43818/" title="Win10开启上帝模式">Win10开启上帝模式</a><time datetime="2022-03-08T12:24:42.000Z" title="Created 2022-03-08 20:24:42">2022-03-08</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/55966/" title="Ubuntu修改静态IP"><img src="https://pic.imgdb.cn/item/621ddc1c2ab3f51d914c66cb.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Ubuntu修改静态IP"/></a><div class="content"><a class="title" href="/posts/55966/" title="Ubuntu修改静态IP">Ubuntu修改静态IP</a><time datetime="2022-03-04T16:11:25.000Z" title="Created 2022-03-05 00:11:25">2022-03-05</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/42154/" title="Java封装同步锁"><img src="https://pic.imgdb.cn/item/621ddc1c2ab3f51d914c66cb.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="Java封装同步锁"/></a><div class="content"><a class="title" href="/posts/42154/" title="Java封装同步锁">Java封装同步锁</a><time datetime="2022-03-02T12:50:01.000Z" title="Created 2022-03-02 20:50:01">2022-03-02</time></div></div><div class="aside-list-item"><a class="thumbnail" href="/posts/1553/" title="初识大数据(一)"><img src="https://cdn.jsdelivr.net/gh/jerryc127/CDN@latest/cover/default_bg3.png" onerror="this.onerror=null;this.src='/img/404.jpg'" alt="初识大数据(一)"/></a><div class="content"><a class="title" href="/posts/1553/" title="初识大数据(一)">初识大数据(一)</a><time datetime="2022-03-01T07:53:43.000Z" title="Created 2022-03-01 15:53:43">2022-03-01</time></div></div></div></div></div></div></main><footer id="footer" style="background-image: url('https://pic.imgdb.cn/item/612111984907e2d39c4793a9.jpg')"><div id="footer-wrap"><div class="copyright">&copy;2017 - 2022 By Lorem Moon</div><div class="framework-info"><span>Framework </span><a target="_blank" rel="noopener" href="https://hexo.io">Hexo</a><span class="footer-separator">|</span><span>Theme </span><a target="_blank" rel="noopener" href="https://github.com/jerryc127/hexo-theme-butterfly">Butterfly</a></div><div class="footer_custom_text">Hi, welcome to my <a target="_blank" rel="noopener" href="https://hello-blogger-ui.blogspot.com/">google blog</a>!</div></div></footer></div><div id="rightside"><div id="rightside-config-hide"><button id="readmode" type="button" title="Read Mode"><i class="fas fa-book-open"></i></button><button id="darkmode" type="button" title="Switch Between Light And Dark Mode"><i class="fas fa-adjust"></i></button><button id="hide-aside-btn" type="button" title="Toggle between single-column and double-column"><i class="fas fa-arrows-alt-h"></i></button></div><div id="rightside-config-show"><button id="rightside_config" type="button" title="Setting"><i class="fas fa-cog fa-spin"></i></button><button class="close" id="mobile-toc-button" type="button" title="Table Of Contents"><i class="fas fa-list-ul"></i></button><a id="to_comment" href="#post-comment" title="Scroll To Comments"><i class="fas fa-comments"></i></a><button id="go-up" type="button" title="Back To Top"><i class="fas fa-arrow-up"></i></button></div></div><div id="algolia-search"><div class="search-dialog"><nav class="search-nav"><span class="search-dialog-title">Algolia</span><button class="search-close-button"><i class="fas fa-times"></i></button></nav><div class="search-wrap"><div id="algolia-search-input"></div><hr/><div id="algolia-search-results"><div id="algolia-hits"></div><div id="algolia-pagination"></div><div id="algolia-stats"></div></div></div></div><div id="search-mask"></div></div><div><script src="/js/utils.js"></script><script src="/js/main.js"></script><script src="https://cdn.jsdelivr.net/npm/@fancyapps/ui/dist/fancybox.umd.js"></script><script src="https://cdn.jsdelivr.net/npm/algoliasearch@4/dist/algoliasearch-lite.umd.js"></script><script src="https://cdn.jsdelivr.net/npm/instantsearch.js@4/dist/instantsearch.production.min.js"></script><script src="/js/search/algolia.js"></script><div class="js-pjax"><script>function loadValine () {
  function initValine () {
    const valine = new Valine(Object.assign({
      el: '#vcomment',
      appId: 'mFM6i90bN6KqyTH6tmC3q7dz-gzGzoHsz',
      appKey: 'T2tsKoiKjMaB0wgtIAgSz6Ul',
      avatar: 'monsterid',
      serverURLs: '',
      emojiMaps: "",
      path: window.location.pathname,
      visitor: false
    }, null))
  }

  if (typeof Valine === 'function') initValine() 
  else getScript('https://cdn.jsdelivr.net/npm/valine/dist/Valine.min.js').then(initValine)
}

if ('Valine' === 'Valine' || !false) {
  if (false) btf.loadComment(document.getElementById('vcomment'),loadValine)
  else setTimeout(loadValine, 0)
} else {
  function loadOtherComment () {
    loadValine()
  }
}</script></div><script async data-pjax src="//busuanzi.ibruce.info/busuanzi/2.3/busuanzi.pure.mini.js"></script></div></body></html>